<?php

namespace App\Http\Controllers\Api\V1;

use Illuminate\Support\Facades\Cache;

class SearchesController extends Controller
{
    public function history()
    {
    	$user = request()->user();
	    $cacheValue = Cache::get($user->searchProductCacheKey(), []);
	    return response()->json(['data' => $cacheValue]);
    }

    public function destroy()
    {
	    Cache::forget(request()->user()->searchProductCacheKey());
	    return response(null, 204);
    }
}
